/**
 * @file    iap_master.h
 * @brief   主机升级接口
 * @author  Liuwei
 * @version 1.0.1
 * @date    2023-05-24
 * 
 * @copyright Copyright (c) 2023 JBD-Energy Storage Technology Co. LTD
 * 
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Version   <th>Author   <th>Description
 * <tr><td>2023-05-24 <td>1.0.1     <td>Liuwei   <td>首次创建
 * </table>
 */

#ifndef __IAP_MASTER_H_
#define __IAP_MASTER_H_

/* file includes -------------------------------------------------------------*/
#include "mcu_type.h"
/* cplusplus -----------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif

/* macro/define/typedef ------------------------------------------------------*/
#define UPGRADE_CMD_RUN   (0xA01A)

#define APP_START_ADDR  (0x8000)
/**
 * @brief 主机升级变量
 */
typedef struct 
{
    uint8_t salve_addr;
    uint8_t upgrade_cmd;
    uint16_t upgrade_state;
}iap_master_data_type;

/* variables -----------------------------------------------------------------*/
extern iap_master_data_type iap_master_data;
/*******************************************************************************
 * public API List
 ******************************************************************************/
uint8_t iap_master_run_upgrade_slave(uint16_t cycle , uint8_t com_id);
uint8_t iap_master_is_upgrade_slave(void);
void iap_master_start_upgrade_slave(void);

#ifdef __cplusplus
}
#endif

#endif  /* #ifndef __IAP_MASTER_H_ */
/********** Copyright (c) 2023 JBD-Energy Storage Technology Co. LTD *********/



